from selenium import webdriver
import time
#
# driver = webdriver.Chrome()
# driver.get('http://ui.imdsx.cn/uitester/')
# driver.execute_script('window.scrollTo(0,0);')

# #跳到新建标签页面
# element = driver.find_element_by_css_selector('[name="top-frame"]')
# driver.switch_to.frame(element)
# driver.find_element_by_css_selector('#newtag').send_keys(111)
# time.sleep(2)
#
# # 跳到百度的页面
# baiduFrame = driver.find_element_by_css_selector('[name="baidu-frame"]')
# driver.switch_to.frame(baiduFrame)
# driver.find_element_by_css_selector('#kw').send_keys(222)
# time.sleep(2)
# #跳当前iframe的上一层
# driver.switch_to.parent_frame()
# driver.find_element_by_css_selector('#newtag').send_keys('第二次修改')
# time.sleep(2)
# #跳到最外层的页面
# driver.switch_to.default_content()
# driver.get_screenshot_as_file('最外层.png')
# driver.find_element_by_css_selector('#i1').send_keys('已经跳转到最外层')
# time.sleep(2)
# driver.quit()

# alert弹窗
# driver.find_element_by_css_selector('#alert').click()
# time.sleep(2)
# driver.switch_to.alert.accept()
#
# driver.find_element_by_css_selector('#confirm').click()
# time.sleep(2)
# driver.switch_to.alert.dismiss()

# 鼠标悬浮
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Chrome()
# driver.get('http://ui.imdsx.cn/move/')

# driver.execute_script('window.scrollTo(0,0);')
#
# action = ActionChains(driver)
#
# sour = driver.find_element_by_css_selector('#dragger')
# targ = driver.find_element_by_css_selector('#i1')
# action.drag_and_drop(sour, targ).perform()
#
# sour1 = driver.find_element_by_css_selector('#dragger1')
# targ2 = driver.find_element_by_css_selector('#i2')
# action.drag_and_drop(sour1, targ2).perform()
#
# sour2 = driver.find_element_by_css_selector('#dragger2')
# targ3 = driver.find_element_by_css_selector('#i3')
# action.drag_and_drop(sour2, targ3).perform()
#
# sour3 = driver.find_element_by_css_selector('#dragger3')
# targ4 = driver.find_element_by_css_selector('#i4')
# action.drag_and_drop(sour3,targ4).perform()


# select模块

# from selenium.webdriver.support.select import Select
#
# driver = webdriver.Chrome()
# driver.get('http://ui.imdsx.cn/html/')
# driver.execute_script('window.scrollTo(0,0);')
#
# ele = driver.find_element_by_css_selector('[name="city"][multiple="multiple"]')
# # ele = driver.find_element_by_xpath('//select[@name="city"]')
# Select(ele).select_by_value('4')
# time.sleep(3)
# # Select(ele).deselect_by_value('4')
# Select(ele).deselect_all()

#input type = range
driver.get('https://www.xiangshang360.cn/xweb/static/autDetail')
driver.execute_script('document.getElementById("test").children[2].value="8"')



from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
WebDriverWait(driver, 10, 1).until(EC.presence_of_element_located((By.ID, 'i1')))